package com.block.datapush.service.apipush.utils;

import cn.hutool.core.util.StrUtil;
import com.block.common.enums.BaseTypeInfoEnum;
import org.apache.commons.lang3.StringUtils;

/**
 * 小熊钱包-分润 双授权
 */
public class XiaoXiongQianBaoRateUtil {

    //性别
    public static Integer getSex(Integer sex) {
        if (sex == 1) {
            return 1;
        }
        return 2;
    }

    //学历
    public static Integer getEducation(String education) {
        if (StrUtil.equals(BaseTypeInfoEnum.XueLi.xl001.getValue(), education) || StrUtil.equals(BaseTypeInfoEnum.XueLi.xl002.getValue(), education)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.XueLi.xl003.getValue(), education)) {
            return 2;
        }else if (StrUtil.equals(BaseTypeInfoEnum.XueLi.xl004.getValue(), education)) {
            return 3;
        }
        return 5;
    }

    //芝麻分
    public static Integer getZhimaScore(String zhima) {
        if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm001.getValue(), zhima)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm002.getValue(), zhima)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm003.getValue(), zhima)) {
            return 2;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm004.getValue(), zhima)) {
            return 3;
        }
        return 4;
    }

    //公积金
    public static Integer getGongJiJin(String gongjijin) {
        if (StrUtil.equals(BaseTypeInfoEnum.Gjj.gjj001.getValue(), gongjijin)) {
            return 0;
        }
        return 1;
    }

    //社保
    public static Integer getSheBao(String shebao) {
        if (StrUtil.equals(BaseTypeInfoEnum.Shebao.sb001.getValue(), shebao)) {
            return 0;
        }
        return 1;
    }

    //职业
    public static Integer getJob(String job) {
        if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz001.getValue(), job)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz002.getValue(), job)) {
            return 3;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz004.getValue(), job)) {
            return 2;
        }
        return 5;
    }

    //收入
    public static Integer getShouru(String shouru) {
        if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr001.getValue(), shouru)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr002.getValue(), shouru)) {
            return 2;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr003.getValue(), shouru)) {
            return 4;
        }
        return 5;
    }

    public static Integer getHouse(String house) {
        if (StrUtil.equals(BaseTypeInfoEnum.House.hu001.getValue(), house)) {
            return 0;
        }
        return 1;
    }

    public static Integer getCar(String car) {
        if (StrUtil.equals(BaseTypeInfoEnum.Car.car001.getValue(), car)) {
            return 0;
        }
        return 1;
    }

    public static Integer getBaoxian(String baoxian) {
        if (StrUtil.equals(BaseTypeInfoEnum.Baoxian.bx001.getValue(), baoxian)) {
            return 0;
        }
        return 1;
    }

    public static Integer getloan(String loan) {
        if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la001.getValue(), loan)) {
            return 30000;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la002.getValue(), loan)) {
            return 50000;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la003.getValue(), loan)) {
            return 100000;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la004.getValue(), loan)) {
            return 200000;
        }
        return 250000;
    }

    public static Integer getloanTime(String loanTime) {
        if (StrUtil.equals(BaseTypeInfoEnum.LoanTime.lt001.getValue(), loanTime)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanTime.lt002.getValue(), loanTime)) {
            return 2;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanTime.lt003.getValue(), loanTime)) {
            return 3;
        }
        return 5;
    }

    public static Integer getYongTu(String yongtu) {
        if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt002.getValue(), yongtu)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt003.getValue(), yongtu)) {
            return 2;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt004.getValue(), yongtu)) {
            return 3;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt005.getValue(), yongtu)) {
            return 4;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt001.getValue(), yongtu)) {
            return 6;
        }
        return 8;
    }

    public static Integer getXinYongKa(String xinyongka) {
        if (StrUtil.equals(BaseTypeInfoEnum.XinYongKa.xyk001.getValue(), xinyongka)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.XinYongKa.xyk002.getValue(), xinyongka)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.XinYongKa.xyk003.getValue(), xinyongka)) {
            return 2;
        }else if (StrUtil.equals(BaseTypeInfoEnum.XinYongKa.xyk004.getValue(), xinyongka)) {
            return 3;
        }
        return 4;
    }

    public static Integer getHuaBei(String huabei) {
        if (StrUtil.equals(BaseTypeInfoEnum.Huabei.hb001.getValue(), huabei)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Huabei.hb002.getValue(), huabei)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Huabei.hb003.getValue(), huabei)) {
            return 2;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Huabei.hb004.getValue(), huabei)) {
            return 3;
        }
        return 4;
    }

    public static Integer getBaiTiao(String baitiao) {
        if (StrUtil.equals(BaseTypeInfoEnum.Baitiao.bt001.getValue(), baitiao)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Baitiao.bt002.getValue(), baitiao)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Baitiao.bt003.getValue(), baitiao)) {
            return 2;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Baitiao.bt004.getValue(), baitiao)) {
            return 3;
        }
        return 4;
    }

    public static String getReqIp(String ip){
        if (StringUtils.isNotEmpty(ip)){
            return ip;
        }
        return "127.0.0.1";
    }

    public static Integer getYuQi(String yuqi) {
        if (StrUtil.equals(BaseTypeInfoEnum.Yuqi.yq001.getValue(), yuqi)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Yuqi.yq002.getValue(), yuqi) || StrUtil.equals(BaseTypeInfoEnum.Yuqi.yq003.getValue(), yuqi)) {
            return 2;
        }
        return 3;
    }

}
